let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

function fn(arr) {
    let len = arr.length;
    for (let i = 0; i < len; i++) {
        let num = Math.floor(Math.random() * len);
        let temp = arr[num];
        arr[num] = arr[i];
        arr[i] = temp;
    }
    return arr;
}

console.log(fn(arr));